int l1=11;
int l2=12;
int l3=40;
int l4=50;
int salida=23;
int V1=0,V2=0,V3=0, V4=0;
int potenciometro_pin=1;

void setup(){         
  Serial.begin(9600);
  pinMode(l1,OUTPUT);
  pinMode(l2,OUTPUT);
  pinMode(salida,OUTPUT);
  
  
  
  digitalWrite(l1,LOW);
  digitalWrite(l2,LOW);
  digitalWrite(salida,LOW);
}
int valor;
int vpot=0;
int a=0;

  
void loop(){
  
  vpot=analogRead(potenciometro_pin);
  Serial.println(vpot);
  delay(1000);
  
  if(Serial.available())
  {
  valor=Serial.read();
  }
    if( valor=='L'){
      if(V1==1){
        
        
        digitalWrite(l1,HIGH);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(650);
        digitalWrite(l1,LOW);
        
    
  }
        else{digitalWrite(l1,LOW);}
          V1++;
            if(V1==2){V1=0;}
    }
    
    if( valor=='S'){
      if(V1==1){
        
        digitalWrite(l1,HIGH);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(650);
        digitalWrite(l1,LOW);
        
    
  }
        else{digitalWrite(l1,LOW);}
          V1++;
            if(V1==2){V1=0;}
    }
    
      if( valor=='K'){
      if(V1==1){
        
        digitalWrite(l1,HIGH);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(650);
        digitalWrite(l1,LOW);
        
    
  }
        else{digitalWrite(l1,LOW);}
          V1++;
            if(V1==2){V1=0;}
    }
    
    if( valor=='Q'){
      if(V2==1){
        
        
        digitalWrite(l2,HIGH);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(650);
        digitalWrite(l2,LOW);
        
    
  }
        else{digitalWrite(l2,LOW);}
          V2++;
            if(V2==2){V2=0;}
    }
    
    if( valor=='R'){
      if(V2==1){
        
        digitalWrite(l2,HIGH);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(650);
        digitalWrite(l2,LOW);
        
    
  }
        else{digitalWrite(l2,LOW);}
          V2++;
            if(V2==2){V2=0;}
    }
    
      if( valor=='C'){
      if(V2==1){
        
        digitalWrite(l2,HIGH);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(1000);
        delay(650);
        digitalWrite(l2,LOW);
        
    
  }
        else{digitalWrite(l2,LOW);}
          V2++;
            if(V2==2){V2=0;}
    }
    
     if( valor=='H'){
      if(V3==1){
        
        digitalWrite(salida,HIGH);}
         else{digitalWrite(salida,LOW);}
          V3++;
            if(V3==2){V3=0;}
    }
    
  
  
  if(V1>255){V1=0;}
  if(V2>255){V2=0;}
  if(V3>255){V3=0;}
  if(V4>255){V4=0;}
  valor=0;

  
 }
